
import { reset } from "@/utils/table";
import { shrinkage } from "@/utils/form";
import { settingsQueryList, dictionaryQueryListByName } from "@/api/useDataGrid";
export default {
  data() {
    return {
      searchFormApi: {
        ngType: {
          api: settingsQueryList,
          params: {
            "type": "ngType"
          },
          options: []
        },
        modelType: {
          api: dictionaryQueryListByName,
          data: {
            "name": "modelType",
            "status": 0
          },
          options: []
        }
      },
      // 查询条件
      searchForm: {
        options: [
          {
            type: "custom-date-time",
            value: [],
            label: "",
            prop: "customDateTime",
            hide: false,
            backfill: true
          },
          {
            type: "select",
            value: "",
            label: "",
            hide: true,
            prop: "modelType",
            attrs: {
              style: {
                width: "150px"
              },
              clearable: true,
              placeholder: "产品类型"
            },
            childern: []
          },
          {
            type: "select",
            value: "",
            label: "",
            hide: true,
            prop: "ngType",
            attrs: {
              style: {
                width: "150px"
              },
              clearable: true,
              placeholder: "不良品类型"
            },
            childern: []
          },
          {
            type: "select",
            value: "",
            label: "",
            hide: true,
            prop: "status",
            attrs: {
              style: {
                width: "150px"
              },
              clearable: true,
              placeholder: "请选择状态"
            },
            childern: [
              {
                label: "启用",
                value: 1,
                type: "option"
              },
              {
                label: "禁用",
                value: 0,
                type: "option"
              }
            ]
          }
        ],

        btnList: {
          show: true,
          size: "mini",
          btnList: [
            {
              label: "展开",
              mthods: () => shrinkage(1, 0, "searchForm", "isOpenSearch", this, "dataGrid", 210),
              icon: "menu-unfold"
            },
            {
              label: "查询",
              mthods: (form) => this.search(form),
              icon: "el-icon-search",
              type: "primary"
            },
            {
              label: "重置",
              mthods: (form, search) => reset(["codeNumber"], form, search),
              icon: "el-icon-refresh"
            },
            {
              label: "简单表格导出",
              mthods: () => this.download(),
              icon: "el-icon-download"
            }
          ]

        }
      },
      // 查询
      search(form) {
        console.log("查询成功", form, "form");
      }
    };
  },
  created() {
    // setInitOptions("searchForm", this, this.searchFormApi);
  }
};
